package com.mjk.common.ai.entity;

import com.mjk.common.ai.dto.SearchEngineResp;
import com.mjk.common.base.model.BaseEntity;
import com.mjk.common.core.jdbc.annotation.ArcSharding;
import com.mjk.common.core.jdbc.annotation.Filed;
import com.mjk.common.core.jdbc.annotation.Id;
import com.mjk.common.core.jdbc.service.idgenerator.IdGenerateType;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;

import java.time.LocalDateTime;

@Data
@ArcSharding(dataSource = "pg", table = "adi_ai_search_record")
//@Schema(title = "AiSearchRecord对象", description = "AI搜索记录表")
public class AiSearchRecord extends BaseEntity {

    @Id(type = IdGenerateType.AUTO_UUID)
    private Long id;

    @Filed(cloum = "create_time")
    private LocalDateTime createTime;

    @Filed(cloum = "update_time")
    private LocalDateTime updateTime;

    @Filed(cloum = "is_deleted", comment = "是否删除（0：未删除，1：已删除）")
    private Boolean isDeleted;

    @Filed(cloum = "uuid", comment = "uuid")
    private String uuid;

    @Filed(cloum = "question", comment = "问题")
    private String question;

    @Filed(cloum = "search_engine_response", comment = "Search engine's response content",
            jdbcType = JdbcType.JAVA_OBJECT)
    //typeHandler = SearchEngineRespTypeHandler.class)
    private SearchEngineResp searchEngineResp;

    @Filed(cloum = "prompt", comment = "最终提供给LLM的提示词")
    private String prompt;

    @Filed(cloum = "prompt_tokens", comment = "提供给LLM的提示词所消耗的token数量")
    private Integer promptTokens;

    @Filed(cloum = "answer", comment = "答案")
    private String answer;

    @Filed(cloum = "answer_tokens", comment = "答案消耗的token")
    private Integer answerTokens;

    @Filed(cloum = "user_uuid", comment = "提问用户uuid")
    private String userUuid;

    @Filed(cloum = "user_id", comment = "提问用户id")
    private Long userId;

    @Filed(cloum = "ai_model_id", comment = "ai_model_id")
    private Long aiModelId;
}
